
//% color="#FF00FF" iconWidth=50 iconHeight=40
namespace unihiker_aibayes_analysis{

    //% block="AI舌诊初始化ID[APP_CODE]" blockType="command"
    //% APP_CODE.shadow="string" APP_CODE.def1="c5d773e45a9e4165a987efa3fc74a706"
    export function analysis_init(parameter: any, block: any) {
        let app_code=parameter.APP_CODE.code;
        Generator.addImport(`from ai_tongue import AiTongue`)
        Generator.addCode(`print("AI舌诊模型初始化")
ai_tongue = AiTongue(app_code=${app_code})
`)
    }

    //% block="上传图片[FILENAME]" blockType="reporter"
    //% FILENAME.shadow="string" FILENAME.defl="img.png"
    export function upload_image(parameter: any, block: any) {
        let filename=parameter.FILENAME.code;
        Generator.addCode(`ai_tongue.upload_image(image_file=${filename})`)
    }

    //% block="获取[RES]报告" blockType="reporter"
    //% RES.shadow="string" RES.defl="---"
    export function get_report(parameter: any, block: any) {
        let res=parameter.RES.code;
        Generator.addCode(`ai_tongue.get_report(${res})`)
    }

}
